/**
 * 给定一个URL，将前面的协议输出，域名输出
 * 其后的用'/'分隔的部分，包含'='的输出，即可
 */
#include <bits/stdc++.h>
using namespace std;
#include <bits/extc++.h>
using namespace __gnu_pbds;

using llt = long long;
using vi = vector<int>;
using vll = vector<llt>;

int N;
char S[210];
const char T[] = "/";

void work(){    
    // cin >> S;
    scanf("%s", S);
    char * p = strtok(S, T);
    int t = strlen(p);
    p[t - 1] = '\0';
    printf("%s\n", p);

    p = strtok(NULL, T);
    printf("%s\n", p);


    while(1){
        p = strtok(NULL, T);
        if(not p) break;

        t = strlen(p);
        bool flag = false;
        for(int i=0;i<t;++i){
            if(p[i] == '='){
                flag = true;
                break;
            }
        }
        if(flag) printf("%s\n", p);
    }
	return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);	
    int nofkase = 1;
	// cin >> nofkase;
    scanf("%d", &nofkase);
	while(nofkase--) work();
	return 0;
}